package com.sgs.carbon.web.modules.common.convert.captcha;

import cn.hutool.captcha.AbstractCaptcha;
import com.sgs.carbon.web.modules.common.controller.captcha.vo.SysCaptchaImageRespVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @see <a href="https://github.com/mapstruct/mapstruct"><b>mapstruct</b></a>
 *
 * @author Dave Liu
 * @date 2021-10-08
 */
@Mapper
public interface SysCaptchaConvert {

    SysCaptchaConvert INSTANCE = Mappers.getMapper(SysCaptchaConvert.class);

    default SysCaptchaImageRespVO convert(String uuid, AbstractCaptcha captcha) {
        return SysCaptchaImageRespVO.builder().uuid(uuid).img(captcha.getImageBase64()).build();
    }

}
